package cn.com.thingo.shyintelligent.model.http.api;


import cn.com.thingo.shyintelligent.model.bean.CommonBean;
import cn.com.thingo.shyintelligent.model.bean.GatewayDetailBean;
import cn.com.thingo.shyintelligent.model.bean.GatewayListBean;
import cn.com.thingo.shyintelligent.model.bean.LoginBean;
import cn.com.thingo.shyintelligent.model.bean.MessageListBean;
import cn.com.thingo.shyintelligent.model.bean.UserBean;
import io.reactivex.Flowable;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.Query;

/**
 * Created by Administrator on 2017/10/17.
 */

public interface ShouCheApis {

    //服务器配置
    String HOST = "http://47.105.33.17:8080/shengS/";
    String HOST_ = "http://47.105.33.17:8080/shengS/";
//    String HOST = "http://47.105.33.17:8080/shengS/api/";
//    String HOST_ = "http://47.105.33.17:8080/shengS/";


    //获取手机验证码
    @FormUrlEncoded
    @POST("api/user/sendCode")
    Flowable<CommonBean> sendCode(
            @Field("telPhone") String telephone);

    //用户登录
    @FormUrlEncoded
    @POST("api/user/login")
    Flowable<LoginBean> login(
            @Field("password") String password,
            @Field("telphone") String telephone);

    //用户注册
    @FormUrlEncoded
    @POST("api/user/register")
    Flowable<CommonBean> register(
            @Field("code") String code,
            @Field("password") String password,
            @Field("telphone") String telephone);

    //添加网关
    @FormUrlEncoded
    @POST("api/network/addNetwork")
    Flowable<CommonBean> addGateway(
            @Field("username") String username,
            @Field("password") String password,
            @Field("number") String number,
            @Field("title") String title,
            @Field("token") String token);

    //网关详情
    @FormUrlEncoded
    @POST("api/network/detail")
    Flowable<GatewayDetailBean> gatewayDetail(
            @Field("token") String token,
            @Field("id") String gatewayId);

    //网关修改
    @FormUrlEncoded
    @POST("api/network/updNetwork")
    Flowable<CommonBean> updateGateway(
            @Field("token") String token,
            @Field("id") String gatewayId,
            @Field("title") String title);

    //网关列表
    @FormUrlEncoded
    @POST("api/network/list")
    Flowable<GatewayListBean> gatewayList(
            @Field("token") String token);

    //获取个人信息
    @GET("api/user/index")
    Flowable<UserBean> getUser(
            @Query("token") String token);

    //修改头像
    @Multipart
    @POST("api/user/upload")
    Flowable<CommonBean> modifyHead(
            @Part("token") RequestBody token,
            @Part() MultipartBody.Part headPic);

    //修改密码
    @FormUrlEncoded
    @POST("api/user/updPassword")
    Flowable<CommonBean> modifyPassword(
            @Field("newPassword") String password,
            @Field("telphone") String telephone,
            @Field("code") String code);

    //添加用户报警信息
    @FormUrlEncoded
    @POST("msg/addReportMsg")
    Flowable<CommonBean> addMessage(
            @Field("token") String token,
            @Field("title") String title,
            @Field("content") String content);

    //用户报警信息列表
    @FormUrlEncoded
    @POST("msg/getReportMsgList")
    Flowable<MessageListBean> messageList(
            @Field("token") String token);

    //用户信息未读数
    @FormUrlEncoded
    @POST("msg/getUnreadMsgCount")
    Flowable<CommonBean> messageCount(
            @Field("token") String token);

    //阅读消息
    @FormUrlEncoded
    @POST("msg/userReadMsgStatus")
    Flowable<CommonBean> readMessage(
            @Field("token") String token,
            @Field("messageId") String messageId);

}